package cn.imu.appdevexperiment2020.Application.activity.jiemian;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.List;

import cn.imu.appdevexperiment2020.Application.bean.user.DataBean;
import cn.imu.appdevexperiment2020.R;
public class UserAdapter extends ArrayAdapter<DataBean> {
    private int resourceId;
    public UserAdapter(@NonNull Context context, int textViewResourceId, @NonNull List<DataBean> objects) {
        super(context, textViewResourceId, objects);
        resourceId=textViewResourceId;
    }
    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        DataBean data=getItem(position);
        View view=LayoutInflater.from(getContext()).inflate(resourceId,parent,false);
        TextView userIdtv;
        TextView userNametv;
        TextView nickNametv;
        TextView createBytv;
        TextView phoneNumbertv;
        TextView sextv;
        userIdtv= view.findViewById(R.id.user_userId);
        userNametv= view.findViewById(R.id.user_userName);
        nickNametv= view.findViewById(R.id.user_nickName);
        createBytv =view.findViewById(R.id.user_createBy);
        phoneNumbertv= view.findViewById(R.id.user_phoneNumber);
        sextv= view.findViewById(R.id.user_sex);
        userIdtv.setText(data.getUserId());
        userNametv.setText(data.getUserName());
        nickNametv.setText(data.getNickName());
        createBytv.setText(data.getCreateBy());
        phoneNumbertv.setText(data.getPhonenumber());
        sextv.setText(data.getSex());
        return view;
    }
}